package com.zx.feign.client;

import com.zx.core.wrapper.ListWrapper;
import com.zx.core.wrapper.ObjectWrapper;
import com.zx.feign.client.dto.DictDataDTO;
import com.zx.feign.client.dto.DictTypeDTO;
import com.zx.feign.client.fallbackfactory.DictServiceClientFallbackFactory;
import com.zx.feign.config.FeignConfig;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;

import java.util.List;
import java.util.Map;

/**
 * <p>
 * description: 字典服务客户端接口<br>
 * create: 2025-11-19 <br>
 * </p>
 *
 * @author zhou xun
 */
@FeignClient(value = "zx-system-block", fallbackFactory = DictServiceClientFallbackFactory.class, configuration = FeignConfig.class)
public interface DictServiceClient {

    /**
     * 根据字典类型获取字典数据
     *
     * @param dictType 字典类型
     * @return 字典数据列表
     */
    @GetMapping("/public/dict/data/dto/{dictType}")
    ListWrapper<DictDataDTO> getDictDataByType(@PathVariable("dictType") String dictType);

    /**
     * 批量获取多个字典类型的数据
     *
     * @param dictTypes 字典类型列表
     * @return 多个字典类型的数据
     */
    @PostMapping("/public/dict/data/dto/batch")
    ObjectWrapper<Map<String, List<DictDataDTO>>> getBatchDictData(@RequestBody List<String> dictTypes);

    /**
     * 获取所有字典类型
     *
     * @return 字典类型列表
     */
    @GetMapping("/public/dict/types/dto")
    ListWrapper<DictTypeDTO> getDictTypes();
}